package com.slz3.business.module.goodsManagement.gooBrandRecommendGoods.service;

import com.slz3.business.frame.module.Repositorys;
import com.slz3.business.module.goodsManagement.gooBrandRecommendGoods.domain.GooBrandRecommendGoods;
import com.slz3.business.module.goodsManagement.gooBrandRecommendGoods.domain.GooBrandRecommendGoodsFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Slf4j
@Service
public class GooBrandRecommendGoodsTransactionalServiceImpl implements GooBrandRecommendGoodsTransactionalService {

    @Override
    public GooBrandRecommendGoods modify(GooBrandRecommendGoods gooBrandRecommendGoodsNew) {
        Repositorys.gooBrandRecommendGoods.test();
        Repositorys.gooBrandRecommendGoods.save(GooBrandRecommendGoodsFactory.initBaseFields());
        System.err.println(1 / 0);
        gooBrandRecommendGoodsNew.setLastModifyTime(LocalDateTime.now());
        return Repositorys.gooBrandRecommendGoods.saveAndFlush(gooBrandRecommendGoodsNew);
    }

    @Override
    public List<GooBrandRecommendGoods> batchModify(List<GooBrandRecommendGoods> gooBrandRecommendGoodsList) {
        return Repositorys.gooBrandRecommendGoods.saveAll(gooBrandRecommendGoodsList);
    }
}
